package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
	"house/config"
)

type TextCensor struct {
	ConclusionType uint64 `json:"conclusionType"`
}

func TextCensorContent(message string) bool {
	bd := config.AppConf.BaiDu

	client := censor.NewClient(bd.Ak, bd.Sk)

	res := client.TextCensor(message)
	fmt.Println(res)

	var data TextCensor
	_ = json.Unmarshal([]byte(message), &data)

	if data.ConclusionType == 1 {
		return true
	}
	return false
}
